#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include"stack.h"
#include"queue.h"
#include"priority_queue.h"
#include<vector>
#include<functional>
#include<algorithm>
#include<queue>
using namespace std;

void test_stack()
{
	lh::stack<int> st;
	st.push(1);
	st.push(2);
	st.push(3);
	st.push(4);
	while (!st.empty())
	{
		cout << st.top() << ' ';
		st.pop();
	}
	cout << endl;
}

void test_queue()
{
	//不支持vector,因为vector没有pop_front
	//lh::queue<int,vector<int>> q;
	lh::queue<int> q;
	q.push(1);
	q.push(2);
	q.push(3);
	q.push(4);
	while (!q.empty())
	{
		cout << q.front() << ' ';
		q.pop();
	}
	cout << endl;
}

void test_priority_queue()
{
	std::less<int>ls;
	std::priority_queue<int> pq(ls);

	pq.push(1);
	pq.push(2);
	pq.push(3);
	pq.push(4);
	while (!pq.empty())
	{
		cout << pq.top() << ' ';
		pq.pop();
	}
	cout << endl;

	int a[] = { 3, 2, 7, 6, 0, 4, 1, 9, 8, 5 };
	lh::priority_queue<int>head(a, a + sizeof(a) / sizeof(int));
	while (!head.empty())
	{
		cout << head.top() << ' ';
		head.pop();
	}
	cout << endl;
	lh::priority_queue<int,vector<int>,greater<int>>ghead(a, a + sizeof(a) / sizeof(int));
	while (!ghead.empty())
	{
		cout << ghead.top() << ' ';
		ghead.pop();
	}
	cout << endl;

}

int main()
{
	test_stack();
	test_queue();
	test_priority_queue();
	return 0;
}